<?php
/**
 * Created by PhpStorm.
 * User: 技术员专用
 * Date: 2019/3/19
 * Time: 17:09
 */
//所有task任务
namespace app\common\lib\task;
use app\common\lib\Redis;
use app\common\lib\redis\Predis;
class Task{
   public function sendSms($data,$serv){
       //发送短信
       //todo


       //将验证码存储到redis
       Predis::getInstance()->set(Redis::smsKey($data['phone']),$data['code'],120);
       return 'send success';
   }
   public function pushLive($data,$serv){
       $client=Predis::getInstance()->smember('live_key');
       foreach ($client as $fd){
           $serv->push($fd,json_encode($data));
       }
   }
}